<template>
  <!--  <el-button>button</el-button>-->
  <div style="padding: 10px">
    <!--    功能区域-->
    <div style="padding: 10px">
      <span style="font-size: 20px">资产生命周期</span>
    </div>
    <!-- 搜索区域 -->
    <div style="margin: 10px 0">
     <el-input v-model="search" placeholder="请输入固定资产编码" style="width: 15% "></el-input>
     <el-button type="primary" @click="load" style="margin-left: 5px">查询</el-button>
    </div>
    <!-- 显示库存表格 -->


    <div>
        <el-table
          :data="lifeData"
          border
          stripe
          style="width: 100%">
          <el-table-column prop="gcode" label="固定资产编码" sortable width="180">
          </el-table-column>
          <el-table-column prop="gname" label="设备名称" sortable width="180">
          </el-table-column>
          <el-table-column prop="time" label="变更时间" :formatter="formatter">
          </el-table-column>
          <el-table-column prop="changestore" label="变更地点" sortable :formatter="formatter">
          </el-table-column>
        </el-table>

    </div>

    <!--    新增表单-->
    <!--   调拨表单 -->
  </div>
</template>




<script>
import request from "../utils/request";

export default {
  data() {
    return {
      search:'',
      lifeData: []
  }
  },
  created() {
    // console.log(1111);
    // this.getnewtabledata();
    // this.getstore();
    this.load()
  },
  methods: {

    load(){
      request.get('/api/lifecycle',{

        params: {
          pageNum: this.currentPage,
          pageSize: this.pageSize,
          search: this.search
        }
      }).then(res => {
        console.log(res)
        this.lifeData = res.data.records
        console.log(this.lifeData);
        for (let item of this.lifeData){
          item.changestore = `${item.changestoreout}   - - >   ${item.changestorein}`
          // console.log(item);
        }
        // this.lifeData.changestore = `${this.lifeData.changestoreout} + ${this.lifeData.changestorein}`
         console.log(this.lifeData);
        this.total = res.data.total
      })
    },


    handleChange(value){
        console.log(value[0]);
    },

    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
}
</script>